title: “20171205 C standard GB” editor_options: chunk_output_type: console date: “2017-12-06” output: html_document: df_print: paged —
library(isoreader)
library(isoprocessorCUB)
library(readxl)
library(dplyr)
library(ggplot2)
library(plotly)
library(knitr)
library(stringr)
knitr::opts_chunk$set(
dev=c("png", "pdf"), dev.args=list(pdf = list(encoding="WinAnsi", useDingbats=FALSE)),
fig.keep="all", fig.path=file.path("plots", "20171203_C_standards_GB_"))
Load data
# loading from stored files
collections <-
c(
"171201_alkanesTest_C_shortenedCapillary_ND.cf.rda",
"171204.cf.rda"
)
isofiles <- iso_read_continuous_flow(file.path("data", collections))
## Info: preparing to read 2 data file(s)...
## Info: reading file data/171201_alkanesTest_C_shortenedCapillary_ND.cf.rda with '.rda' reader
## Info: loaded data for 16 data files from R Data Archive - checking loaded files for content consistency...
## Info: reading file data/171204.cf.rda with '.rda' reader
## Info: loaded data for 18 data files from R Data Archive - checking loaded files for content consistency...
Files overview
isofiles %>%
iso_get_file_info(select = c(Analysis, starts_with("Id"), Preparation, `GC Method`, `Seed Oxidation`)) %>%
kable()
## Info: aggregating file info from 34 data file(s)
| BF2803____.dxf |
BF2803 |
NA |
NA |
NA |
Disabled |
0 |
| BF2804__0_7V__.dxf |
BF2804 |
0.7V |
NA |
NA |
Disabled |
0 |
| BF2805__1_2V__.dxf |
BF2805 |
1.2V |
NA |
NA |
Disabled |
0 |
| BF2806__3V__.dxf |
BF2806 |
3V |
NA |
NA |
Disabled |
0 |
| BF2807__6V__.dxf |
BF2807 |
6V |
NA |
NA |
Disabled |
0 |
| BF2808____.dxf |
BF2808 |
NA |
NA |
NA |
Disabled |
0 |
| BF2809____.dxf |
BF2809 |
NA |
NA |
NA |
Disabled |
0 |
| BF2810____.dxf |
BF2810 |
NA |
NA |
NA |
Disabled |
0 |
| BF2828_A5_2ul.dxf |
BF2828 |
A5 |
2ul |
14ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
0 |
| BF2829_A5_0_5ul.dxf |
BF2829 |
A5 |
0.5ul |
14ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
0 |
| BF2830_A5_0_2ul.dxf |
BF2830 |
A5 |
0.2ul |
14ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
1 |
| BF2831_A5_0_5ul.dxf |
BF2831 |
A5 |
0.5ul |
14ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
1 |
| BF2832_A5_1_5ul.dxf |
BF2832 |
A5 |
1.5ul |
14ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
1 |
| BF2833_A5_3ul.dxf |
BF2833 |
A5 |
3ul |
14ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
1 |
| BF2834_A5_5ul.dxf |
BF2834 |
A5 |
5ul |
14ng per uL |
OGL Methods71112 GC DB1 60m CH alkanes PTV high volume.tr2.meth |
1 |
| BF2835_A5_8ul.dxf |
BF2835 |
A5 |
8ul |
14ng per uL |
OGL Methods71112 GC DB1 60m CH alkanes PTV high volume.tr2.meth |
1 |
| BF2843_CO2 zero_6V.dxf |
BF2843 |
CO2 zero |
6V |
NA |
Disabled |
0 |
| BF2844_CO2 zero_3V.dxf |
BF2844 |
CO2 zero |
3V |
NA |
Disabled |
0 |
| BF2845_CO2 zero_1_2V.dxf |
BF2845 |
CO2 zero |
1.2V |
NA |
Disabled |
0 |
| BF2846_CO2 zero_0_7V.dxf |
BF2846 |
CO2 zero |
0.7V |
NA |
Disabled |
0 |
| BF2847__Linearity CO2__.dxf |
BF2847 |
Linearity CO2 |
NA |
NA |
Disabled |
0 |
| BF2848__Linearity CO2__.dxf |
BF2848 |
Linearity CO2 |
NA |
NA |
Disabled |
0 |
| BF2849__Linearity CO2__.dxf |
BF2849 |
Linearity CO2 |
NA |
NA |
Disabled |
0 |
| BF2850_A5_0_2ul.dxf |
BF2850 |
A5 |
0.2ul |
14ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
1 |
| BF2851_A5_0_5ul.dxf |
BF2851 |
A5 |
0.5ul |
14ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
1 |
| BF2852_A5_1_5ul.dxf |
BF2852 |
A5 |
1.5ul |
14ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
1 |
| BF2853_A5_3ul.dxf |
BF2853 |
A5 |
3ul |
14ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
1 |
| BF2854_A5_0_2ul.dxf |
BF2854 |
A5 |
0.2ul |
140ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
1 |
| BF2855_A5_0_5ul.dxf |
BF2855 |
A5 |
0.5ul |
140ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
1 |
| BF2856_A5_0_2ul.dxf |
BF2856 |
A5 |
0.2ul |
14ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
1 |
| BF2857_A5_0_5ul.dxf |
BF2857 |
A5 |
0.5ul |
14ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
1 |
| BF2885_A5_1_5uL.dxf |
BF2885 |
A5 |
1.5uL |
14ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
0 |
| BF2886_A5_3uL.dxf |
BF2886 |
A5 |
3uL |
14ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
1 |
| BF2887_A5_0_5uL.dxf |
BF2887 |
A5 |
0.5uL |
140ng per uL |
OGL Methods71024 GC DB1 60m CH alkanes PTV.tr2.meth |
1 |
Chromatogram overview
isofiles %>%
# select only the standards
iso_filter_files(`Identifier 1` == "A5") %>%
iso_plot_continuous_flow_data(data = "44", time_interval = c(1000, 3000), panel_by = "file", zoom = 1) +
theme(legend.position = "none") +
facet_wrap(~file_id)
## Info: applying file filter, keeping 19 of 34 files

Process data
Focus on the analytes and calculate a few summary parameters we want to use later.
data_w_analyte_peaks <-
data_w_peaks %>%
# this is important so that the reference peaks are not caught up in the next set of calculations
filter(is_ref_peak == "no") %>%
# for each analysis calculate averages across analysis
group_by(Analysis) %>%
mutate(
ampl_sample_mean.mV = mean(`Ampl 44`), ampl_sample_sd.mV = sd(`Ampl 44`),
area_sample_mean.Vs = mean(`Intensity 44`), area_sample_sd.Vs = sd(`Intensity 44`)
)
Standards
standards <- read_excel(file.path("metadata", "GC-IRMS standards.xlsx"))
kable(standards)
| C-16 |
-9.1 |
-26.15 |
| C-17 |
-117.5 |
-31.88 |
| C-18 |
-52.0 |
-32.70 |
| C-19 |
-56.3 |
-31.99 |
| C-20 |
-89.7 |
-33.97 |
| C-21 |
-177.8 |
-28.83 |
| C-22 |
-81.3 |
-33.77 |
| C-23 |
-67.2 |
-33.37 |
| C-24 |
-29.7 |
-32.13 |
| C-25 |
-265.6 |
-28.46 |
| C-26 |
-45.9 |
-32.94 |
| C-27 |
-172.8 |
-30.49 |
| C-28 |
-36.8 |
-33.20 |
| C-29 |
-177.8 |
-29.10 |
| C-30 |
-213.6 |
-29.84 |
data_w_stds <-
data_w_analyte_peaks %>%
iso_add_standards(standards)
## Info: added 15 standard entries to 241 out of 241 rows
Calibration
data_w_calibs <- data_w_stds %>%
# prepare for calibration by defining the grouping column(s) and setting default parameters
iso_prepare_for_calibration(group_by = c(Analysis)) %>%
iso_set_default_process_parameters(delta_residual = resid_d13C) %>%
# run calibration
iso_calibrate_delta(model = lm(`d 13C/12C` ~ true_d13C)) %>%
# pull out some columns we want generally available
iso_unnest_calib_data(select = c(starts_with("Id"), ampl_sample_mean.mV))
## Info: preparing data for calibration by grouping based on 'Analysis' and nesting the grouped datasets into 'calibration_data'
## Info: calculating delta calibration fits based on 1 model ('lm(`d 13C/12C` ~ true_d13C)') for 17 data group(s) in 'calibration_data' with filter 'is_standard'; storing residuals in 'resid_d13C.'
data_w_calibs %>%
iso_unnest_delta_calib_summary(keep_other_list_data = FALSE) %>%
kable(digits =3)
| BF2828 |
A5 |
2ul |
2941.484 |
0.999 |
0.999 |
0.074 |
13953.274 |
0 |
2 |
18.847 |
-31.693 |
-29.569 |
0.071 |
13 |
| BF2829 |
A5 |
0.5ul |
626.365 |
0.997 |
0.996 |
0.143 |
3697.360 |
0 |
2 |
8.455 |
-10.910 |
-8.993 |
0.245 |
12 |
| BF2830 |
A5 |
0.2ul |
206.206 |
1.000 |
NaN |
NaN |
NaN |
NaN |
2 |
Inf |
-Inf |
-Inf |
0.000 |
0 |
| BF2831 |
A5 |
0.5ul |
683.263 |
0.981 |
0.980 |
0.336 |
679.300 |
0 |
2 |
-3.833 |
13.665 |
15.789 |
1.464 |
13 |
| BF2832 |
A5 |
1.5ul |
2397.444 |
0.997 |
0.997 |
0.122 |
5062.710 |
0 |
2 |
11.321 |
-16.641 |
-14.517 |
0.194 |
13 |
| BF2833 |
A5 |
3ul |
3409.901 |
0.999 |
0.999 |
0.083 |
10814.818 |
0 |
2 |
17.082 |
-28.165 |
-26.041 |
0.090 |
13 |
| BF2834 |
A5 |
5ul |
6366.513 |
0.952 |
0.949 |
0.518 |
260.647 |
0 |
2 |
-10.343 |
26.685 |
28.809 |
3.487 |
13 |
| BF2835 |
A5 |
8ul |
9463.344 |
0.796 |
0.780 |
1.201 |
50.709 |
0 |
2 |
-22.959 |
51.918 |
54.042 |
18.753 |
13 |
| BF2850 |
A5 |
0.2ul |
469.382 |
0.992 |
0.991 |
0.216 |
1624.493 |
0 |
2 |
2.743 |
0.514 |
2.638 |
0.609 |
13 |
| BF2851 |
A5 |
0.5ul |
1859.622 |
0.996 |
0.996 |
0.147 |
3519.402 |
0 |
2 |
8.554 |
-11.109 |
-8.984 |
0.281 |
13 |
| BF2852 |
A5 |
1.5ul |
6565.095 |
0.976 |
0.974 |
0.367 |
535.619 |
0 |
2 |
-5.165 |
16.331 |
18.455 |
1.749 |
13 |
| BF2853 |
A5 |
3ul |
10855.855 |
0.749 |
0.730 |
1.574 |
38.814 |
0 |
2 |
-27.011 |
60.021 |
62.146 |
32.188 |
13 |
| BF2854 |
A5 |
0.2ul |
1460.165 |
0.995 |
0.994 |
0.175 |
2390.234 |
0 |
2 |
5.895 |
-5.789 |
-3.665 |
0.400 |
13 |
| BF2855 |
A5 |
0.5ul |
4192.515 |
0.990 |
0.990 |
0.234 |
1342.784 |
0 |
2 |
1.546 |
2.907 |
5.032 |
0.715 |
13 |
| BF2885 |
A5 |
1.5uL |
1516.386 |
0.860 |
0.849 |
0.951 |
79.814 |
0 |
2 |
-19.454 |
44.908 |
47.032 |
11.752 |
13 |
| BF2886 |
A5 |
3uL |
2501.210 |
0.973 |
0.971 |
0.406 |
465.060 |
0 |
2 |
-6.706 |
19.413 |
21.537 |
2.148 |
13 |
| BF2887 |
A5 |
0.5uL |
3982.941 |
0.838 |
0.826 |
1.009 |
67.239 |
0 |
2 |
-20.345 |
46.691 |
48.815 |
13.235 |
13 |
data_w_calibs %>%
# pull out seed oxidation in addition
iso_unnest_calib_data(select = `Seed Oxidation`) %>%
iso_unnest_delta_calib_coefs(select = c(-statistic), keep_other_list_data = FALSE) %>%
# arrange by term and Analysis to get a quick idea of what the numbers across analyses
arrange(term, Analysis) %>%
kable(digits = 2)
| BF2828 |
A5 |
2ul |
2941.48 |
0 |
(Intercept) |
10.95 |
0.27 |
0.00 |
*** |
| BF2829 |
A5 |
0.5ul |
626.37 |
0 |
(Intercept) |
11.30 |
0.52 |
0.00 |
*** |
| BF2830 |
A5 |
0.2ul |
206.21 |
1 |
(Intercept) |
13.79 |
NaN |
NaN |
NA |
| BF2831 |
A5 |
0.5ul |
683.26 |
1 |
(Intercept) |
10.75 |
1.21 |
0.00 |
*** |
| BF2832 |
A5 |
1.5ul |
2397.44 |
1 |
(Intercept) |
10.80 |
0.44 |
0.00 |
*** |
| BF2833 |
A5 |
3ul |
3409.90 |
1 |
(Intercept) |
10.69 |
0.30 |
0.00 |
*** |
| BF2834 |
A5 |
5ul |
6366.51 |
1 |
(Intercept) |
9.84 |
1.87 |
0.00 |
*** |
| BF2835 |
A5 |
8ul |
9463.34 |
1 |
(Intercept) |
10.04 |
4.33 |
0.04 |
* |
| BF2850 |
A5 |
0.2ul |
469.38 |
1 |
(Intercept) |
10.61 |
0.78 |
0.00 |
*** |
| BF2851 |
A5 |
0.5ul |
1859.62 |
1 |
(Intercept) |
10.73 |
0.53 |
0.00 |
*** |
| BF2852 |
A5 |
1.5ul |
6565.10 |
1 |
(Intercept) |
10.13 |
1.32 |
0.00 |
*** |
| BF2853 |
A5 |
3ul |
10855.86 |
1 |
(Intercept) |
13.85 |
5.67 |
0.03 |
* |
| BF2854 |
A5 |
0.2ul |
1460.17 |
1 |
(Intercept) |
10.27 |
0.63 |
0.00 |
*** |
| BF2855 |
A5 |
0.5ul |
4192.52 |
1 |
(Intercept) |
10.50 |
0.85 |
0.00 |
*** |
| BF2885 |
A5 |
1.5uL |
1516.39 |
0 |
(Intercept) |
9.42 |
3.43 |
0.02 |
* |
| BF2886 |
A5 |
3uL |
2501.21 |
1 |
(Intercept) |
10.72 |
1.47 |
0.00 |
*** |
| BF2887 |
A5 |
0.5uL |
3982.94 |
1 |
(Intercept) |
8.57 |
3.64 |
0.03 |
* |
| BF2828 |
A5 |
2ul |
2941.48 |
0 |
true_d13C |
1.01 |
0.01 |
0.00 |
*** |
| BF2829 |
A5 |
0.5ul |
626.37 |
0 |
true_d13C |
1.01 |
0.02 |
0.00 |
*** |
| BF2830 |
A5 |
0.2ul |
206.21 |
1 |
true_d13C |
1.10 |
NaN |
NaN |
NA |
| BF2831 |
A5 |
0.5ul |
683.26 |
1 |
true_d13C |
1.01 |
0.04 |
0.00 |
*** |
| BF2832 |
A5 |
1.5ul |
2397.44 |
1 |
true_d13C |
1.00 |
0.01 |
0.00 |
*** |
| BF2833 |
A5 |
3ul |
3409.90 |
1 |
true_d13C |
1.00 |
0.01 |
0.00 |
*** |
| BF2834 |
A5 |
5ul |
6366.51 |
1 |
true_d13C |
0.96 |
0.06 |
0.00 |
*** |
| BF2835 |
A5 |
8ul |
9463.34 |
1 |
true_d13C |
0.98 |
0.14 |
0.00 |
*** |
| BF2850 |
A5 |
0.2ul |
469.38 |
1 |
true_d13C |
1.00 |
0.02 |
0.00 |
*** |
| BF2851 |
A5 |
0.5ul |
1859.62 |
1 |
true_d13C |
1.00 |
0.02 |
0.00 |
*** |
| BF2852 |
A5 |
1.5ul |
6565.10 |
1 |
true_d13C |
0.98 |
0.04 |
0.00 |
*** |
| BF2853 |
A5 |
3ul |
10855.86 |
1 |
true_d13C |
1.13 |
0.18 |
0.00 |
*** |
| BF2854 |
A5 |
0.2ul |
1460.17 |
1 |
true_d13C |
0.99 |
0.02 |
0.00 |
*** |
| BF2855 |
A5 |
0.5ul |
4192.52 |
1 |
true_d13C |
0.99 |
0.03 |
0.00 |
*** |
| BF2885 |
A5 |
1.5uL |
1516.39 |
0 |
true_d13C |
0.98 |
0.11 |
0.00 |
*** |
| BF2886 |
A5 |
3uL |
2501.21 |
1 |
true_d13C |
1.01 |
0.05 |
0.00 |
*** |
| BF2887 |
A5 |
0.5uL |
3982.94 |
1 |
true_d13C |
0.95 |
0.12 |
0.00 |
*** |
Standards
Parameters
data_params <- data_w_calibs %>%
# pull out remaining columns we want available (some might already be pulled out but that's okay)
iso_unnest_calib_data(select = c(file_datetime, ampl_sample_mean.mV, Preparation, is_standard))
# visualize the delta calibration fits
data_params %>%
iso_visualize_delta_calib_fits(x = Analysis, color = `Identifier 2`, shape = Preparation, size = ampl_sample_mean.mV,
include_from_summary = c(adj.r.squared, deviance)) + labs(title = "parameters vs. analysis")

data_params %>%
iso_visualize_delta_calib_fits(x = ampl_sample_mean.mV, color = `Identifier 2`, shape = Preparation, size = ampl_sample_mean.mV,
include_from_summary = c(adj.r.squared, deviance)) + labs(title = "parameters vs. amplitude")

data_params %>%
iso_visualize_delta_calib_fits(x = file_datetime, color = `Identifier 2`, shape = Preparation, size = ampl_sample_mean.mV,
include_from_summary = c(adj.r.squared, deviance)) + labs(title = "parameters vs. time")

# turn the last plot into an interactive one
ggplotly(ggplot2::last_plot() + theme(legend.position = "none"))
Compounds
data_w_calibs %>%
# pull out relevant data
iso_unnest_calib_data(select = everything()) %>%
filter(is_standard) %>%
# calculate deviation from means
group_by(Analysis) %>%
mutate(
`Var: residual d13C [permil]` = resid_d13C,
`Var: area diff from mean [%]` = (`Intensity 44`/mean(`Intensity 44`) - 1) * 100,
`Var: amplitude diff from mean [%]` = (`Ampl 44`/mean(`Ampl 44`) - 1) * 100
) %>%
# visualize
iso_visualize_data(x = compound, y = starts_with("Var"), group = Analysis, color = `Identifier 2`)

ggplotly(ggplot2::last_plot())
Data
FIXME: continue here with inverting calibration